var bodyObj=document.body
var t
var num=200
bodyObj.onclick=function(evt){
    var e=evt||window.event
    var target=e.target||e.srcElement
    if(target.nodeName==='IMG'){
        bodyObj.removeChild(target)
        num=num+3
    }
}
    document.querySelector('#kaishi').onclick=function(){
        clearInterval(t)
    t=setInterval(function(){
        num=num-2.5
    var xuetiao=document.querySelector('div>span')
    xuetiao.style.width=num
    if(num<=0){
        alert('游戏失败')
        num=200
        clearInterval(t)
    }if(num>=200){
        alert('游戏成功')
        num=200
        clearInterval(t)
    }
    var imgObj=document.createElement('img')
    imgObj.src="imgs/star.gif"
    var min=20
    var max=100
    imgObj.width=Math.floor(Math.random()*(max-min+1)+min)
    imgObj.style.position='absolute'
    var min=0
    var max=(window.innerWidth||document.documentElement.clientWidth)-imgObj.width
    imgObj.style.left=Math.floor(Math.random()*(max-min+1)+min)+'px'
    var max=(window.innerHeight||document.documentElement.clientHeight)-imgObj.width
    imgObj.style.top=Math.floor(Math.random()*(max-min+1)+min)+'px'
    document.body.appendChild(imgObj)
},500)
}
var zanting=document.querySelector('#zanting')
zanting.onclick=function(){
    clearInterval(t)
}